﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Drawing.Drawing2D;

namespace 绘制直线
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Paint(object sender, PaintEventArgs e)
        {
            Graphics g = e.Graphics;   //创建画布
            Pen pen = new Pen(Color.Aqua, 1);   //创建画笔
            g.DrawLine(pen, 10, 10, 100, 100);  //画线
            pen.DashStyle = DashStyle.Dash;     //指定画笔样式
            g.DrawLine(pen, 10, 20, 100, 100);
            pen.DashStyle = DashStyle.DashDot;  //指定画笔样式
            g.DrawLine(pen, 10, 30, 100, 100);
        }

        private void Form1_Load(object sender, EventArgs e)
        {

        }
    }
}
